package memento.pattern.demo;

public class Originator {
    private String state;
    Memento m;

      public void setState(String state) {
        this.state = state;
    }
    //Creates memento
    public Memento orginatorMemento(){
          m = new Memento(state);
          return m;
    }
    //back to state
    public void Revert(Memento memento){
        System.out.println("Restoring to previous state");
        state = memento.getState();
        System.out.println("State at present :"+ state);
    }
}
